<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

Route::get('/', function () {
    return view('index');
});

Route::post('/', 'api/Index/jssdk')->allowCrossDomain();


Route::group('admin', function () {
    Route::get('/', 'admin/Index/index');

    Route::post('upload', 'admin/Upload/upload');

    Route::get('login', 'admin/Index/login');
    Route::post('login', 'admin/Index/login_a');
    Route::post('logout', 'admin/Index/logout_a');

    Route::get('intro', 'admin/Index/intro');
    Route::put('intro', 'admin/Index/intro_update');

    Route::get('comments', 'admin/Index/comments');
    Route::put('comment/:id/show', 'admin/Index/comment_show');
    Route::put('comment/:id/hide', 'admin/Index/comment_hide');
    Route::delete('comment/:id', 'admin/Index/comment_delete');

    Route::get('teams', 'admin/Index/teams');
    Route::get('team/:id/edit', 'admin/Index/team_edit');
    Route::put('team/:id', 'admin/Index/team_update');
    Route::get('team', 'admin/Index/team_create');
    Route::post('team', 'admin/Index/team_store');
    Route::delete('team/:id', 'admin/Index/team_delete');

    Route::get('judges', 'admin/Index/judges');
    Route::get('judge/:id/edit', 'admin/Index/judge_edit');
    Route::put('judge/:id', 'admin/Index/judge_update');
    Route::get('judge', 'admin/Index/judge_create');
    Route::post('judge', 'admin/Index/judge_store');
    Route::delete('judge/:id', 'admin/Index/judge_delete');
});

Route::group('api', function () {
    Route::get('teams', 'api/Index/teams');
    Route::get('team/:id', 'api/Index/team');

    Route::get('judges', 'api/Index/judges');
    Route::get('judge/:id', 'api/Index/judge');
    Route::post('judge/login', 'api/Index/judge_login');
    Route::post('judge/teams', 'api/Index/judge_teams');

    Route::get('comments', 'api/Index/comments');
    Route::post('comment', 'api/Index/comment_store');

    Route::get('intro', 'api/Index/intro');

    Route::post('judge_team/:id', 'api/Index/judge_team_score');

})->allowCrossDomain();




